<?php
/**
 * 已经反馈
 * @author 鸣枫
 *
 */
error_reporting(E_ALL ^ E_NOTICE);
class Feedback extends CT_Controller{
    
    private $member_id;     //用户ID
    
    function __construct() {
        parent::__construct();
        
        $this->member_id = $this->_uid;
        
        if(!$this->member_id && !$this->input->is_ajax_request()){
            redirect('/login');
        }
    }
    
    function index(){
        $this->ct_template->write('_title', '意见反馈');
        $this->ct_template->write_view('content', 'feedback/index',array(
            
        ), FALSE);
        $this->ct_template->render();
    }
    /**
     * 入库
     */
    function insertfeedback(){
        try {
            $message = $this->input->get('message');    //内容
            if(empty($message))throw new Exception('内容为空');
            
            $this->load->model('feedback_model');
            $data = array(
                'member_id' =>  $this->member_id,
                'message'   =>  $message,
                'create_date'   =>  date('Y-m-d H:i:s'),
            );
            $this->feedback_model->insert($data);
        }catch (Exception $e){
            $this->ct_template->write('_title', '错误提示');
            $this->ct_template->write_view('content', 'errors/html/warn', array('msg'=>$e->getMessage() ), FALSE);
            $this->ct_template->render();
        }
        redirect("/");
    }
}










